import VUE from 'vue'
import VUEX from 'vuex'

VUE.use(VUEX)

const state = {
  isPractice: false, //练习模式标志
  flag: false, //菜单栏左右滑动标志
  userInfo: null,
  menu: [
    {
      index: '1',
      title: '课程管理',
      icon: 'el-icon-s-order',
      content:[{item1:'所有课程',path:'/courseManage'},{item2: '参课管理',path: '/joinCourseManage'}],
    },
    {
      index: '2',
      title: '学生管理',
      icon: 'el-icon-user-solid',
      content:[{item1:'所有学生',path:'/studentManage'}],
    },
    {
      index: '3',
      title: '试题管理',
      icon: 'el-icon-s-management',
      content:[{item1:'选择题',path:'/topicMult'},{item2:'试题',path:'/topicSingle'},{path: '/addTopic'}],
    },
    {
      index: '4',
      title: '试卷管理',
      icon: 'el-icon-s-claim',
      content:[{item1:'所有试卷',path:'/examPaperManage'}],
    },
    {
      index: '5', //
      title: '考试管理',
      icon: 'el-icon-s-platform',
      content:[{item1:'所有考试',path:'selectExam'}],
    },
    {
      index: '6', //
      title: '成绩管理',
      icon: 'el-icon-s-marketing',
      content:[{item1:'学生成绩',path:'/scoreManage'},{path: '/grade'},{item2: '成绩分段',path: '/selectExamToPart'},{path: '/scorePart'}],
    },
    {
      index: '7',
      title: '问题管理',
      icon: 'el-icon-s-promotion',
      content:[{item1:'所有问题',path:'/questionManage'},{item2:'所有回复',path:'/replyManage'}],
    },
    {
      index: '8',
      title: '消息管理',
      icon: 'el-icon-s-comment',
      content:[{item1:'系统消息',path:'/sysMessage'}],
    },
    {
      index: '9',
      title: '日志管理',
      icon: 'el-icon-menu',
      content:[{item1:'所有日志',path:'/logManage'}],
    }
  ],
}
const mutations = {
  practice(state,status) {
    state.isPractice = status
  },
  toggle(state) {
    state.flag = !state.flag
  },
  changeUserInfo(state,info) {
    state.userInfo = info
  }
}
const getters = {

}
const actions = {
  getUserInfo(context,info) {
    context.commit('changeUserInfo',info)
  },
  getPractice(context,status) {
    context.commit('practice',status)
  }
}
export default new VUEX.Store({
  state,
  mutations,
  getters,
  actions,
  // store
})
